package com.wude.guild.adapter;

import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.wude.bean.TaskBean;
import com.wude.bean.TaskBean;
import com.wude.guild.holder.EverydayTaskHolder;
import com.wude.guild.holder.JifenDetailHolder;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 唐小妹 on 2017/12/11 0011.
 */

public class EverydayTaskAdapter extends BaseAdapter {
    private Activity activity;
    private List<TaskBean> data = new ArrayList<>();

    public EverydayTaskAdapter(Activity activity) {
        this.activity = activity;
    }

    public void setData(List<TaskBean> data) {
        this.data = data;
    }

    @Override
    public int getCount() {
        return data == null ? 0 : data.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        EverydayTaskHolder holder = null;
        if (holder == null) {
            holder = new EverydayTaskHolder();
        } else {
            holder = (EverydayTaskHolder) view.getTag();
        }
        TaskBean taskBean = data.get(i);
        holder.setData(taskBean, i, activity);
        return holder.getContentView();
    }
}
